"""
@Name:practice3.py
@Auth:YJ
@Date:2023/11/3
"""
from matplotlib import pyplot as plt
from matplotlib import font_manager

# 中文显示
my_font = font_manager.FontProperties(fname="C:\Windows\Fonts\SIMHEI.TTF")

y = [1, 0, 1, 1, 2, 4, 3, 2, 3, 4, 4, 5, 6, 5, 4, 3, 3, 1, 1, 1]
x = range(11, 31)

# 设置图形大小
plt.figure(figsize=(20, 8), dpi=80)

plt.plot(x, y)
# 设置x轴刻度
_xtick_labels = ["{}岁".format(i) for i in x]
plt.xticks(x, _xtick_labels, fontproperties=my_font)
plt.yticks(range(0, 9))
# 设置网格 alpha -- 透明度（0-1)
plt.grid(alpha=0.4)
plt.show()
